import React, { Component } from 'react';
import { Drawer, Button } from 'antd';
import styles from './index.less';

class Eject extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    const { btnType, title, width, onClose, visible, modelJsx, showDrawer, value } = this.props;
    return (
      <div className={styles.eject}>
        {btnType ? (
          <Button type={btnType} onClick={showDrawer}>
            {value}
          </Button>
        ) : null}
        <Drawer title={title} width={width} onClose={onClose} visible={visible}>
          <div className={styles.ejectBody}>{modelJsx}</div>
          <div
            style={{
              // position: 'relative',
              position: 'absolute',
              left: 0,
              bottom: 0,
              width: '100%',
              borderTop: '1px solid #e9e9e9',
              padding: '10px 16px',
              background: '#fff',
              textAlign: 'center',
            }}
          >
            <Button onClick={this.props.handleOkBtnClick} type="primary" style={{ marginRight: 8 }}>
              确定
            </Button>
            <Button onClick={this.props.onClose}>取消</Button>
          </div>
        </Drawer>
      </div>
    );
  }
}
export default Eject;
